﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XCommunity.Data;

namespace XCommunity.Views
{
  public static class ViewFilterExtensions
  {

    public static IEnumerable<T> Filter<T>( this IEnumerable<IViewFilter> filters, IEnumerable<T> list )
    {
      foreach ( var item in filters )
        list = item.Filter( list );

      return list;
    }


    public static IPagingDataSource<T> Filter<T>( this IEnumerable<IViewPagingFilter> filters, IPagingDataSource<T> list )
    {
      foreach ( var item in filters )
        list = item.Filter( list );

      return list;
    }

  }
}